package hoangbn.apps;

import hoangbn.apps.adapter.MenuAdapter;
import hoangbn.apps.util.Variables;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

public class MenuActivity extends ListActivity {

	String[] menuItems = null;
	int[] imgs = null;
	float[] prices = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		int category = 0;
		int quan = 0;
		this.setTitle(Variables.CATEGORIES[category] + " Quan "
				+ String.valueOf(quan + 1));
		MenuAdapter menuAdapter = null;
		switch (quan) {
		case 0:
			menuItems = Variables.QUAN_1_Menu[category];
			imgs = Variables.QUAN_1_MENU_IMGS[category];
			prices = Variables.QUAN_1_MENU_PRICES[category];
			menuAdapter = new MenuAdapter(this, R.layout.activity_menu,
					menuItems, imgs, prices);
			break;
		case 1:
			menuItems = Variables.QUAN_2_Menu[category];
			imgs = Variables.QUAN_2_MENU_IMGS[category];
			prices = Variables.QUAN_2_MENU_PRICES[category];
			menuAdapter = new MenuAdapter(this, R.layout.activity_menu,
					menuItems, imgs, prices);
			break;
		case 2:
			menuItems = Variables.QUAN_3_Menu[category];
			imgs = Variables.QUAN_3_MENU_IMGS[category];
			prices = Variables.QUAN_3_MENU_PRICES[category];
			menuAdapter = new MenuAdapter(this, R.layout.activity_menu,
					menuItems, imgs, prices);
			break;
		default:
			break;
		}
		this.setListAdapter(menuAdapter);
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		Intent i = new Intent(this, MapActivity.class);
		i.putExtra(Variables.X, 10.772023f);
		i.putExtra(Variables.Y, 106.657868f);
		this.startActivity(i);
	}
}
